/*对背景的设置*/
	function show(){
		var arrIma=[];
		arrIma[0]="images/background1.jpg";
		arrIma[1]="images/background2.jpg";
		arrIma[2]="images/background3.jpg";
		arrIma[3]="images/background4.jpg";
		arrIma[4]="images/background5.jpg";
		arrIma[5]="images/background6.jpg";
		arrIma[6]="images/background7.jpg";
		arrIma[7]="images/background8.jpg";
		arrIma[8]="images/background9.jpg";
		arrIma[9]="images/background10.jpg";

		var index =parseInt(Math.random()*(arrIma.length-1));
		var d=new Date();
		var currentImage=arrIma[index];
		document.getElementById("fillmoreInners").style.backgroundImage="url("+currentImage+")";   //显示当前图片
	}
	var theTimer=setInterval('show()', 1000*120);   //设置定时器，显示下一张图片
	window.onload=show;    //页面加载时运行函数show()
	//设置属性
		$(function(){
			$("#fillmores").css("position","fixed");
			//对推荐的音频面板的点击事件的处理
			$("#a1").click(function(){
				$("#fillmorelefts ul li").attr("class","out");
				$("#a1").attr("class","over"); 
				$(".fillmoreright1").css("display","none");
				$(".fillmorerights2_div1_class").css("display","none");
				$("#fillmorerights1").animate({width:'400px'},300).css("display","block");
				$("#fillmores").animate({width:'500px'},300);
				$("#a1").attr("class","over"); 
			});
			$("#a2").click(function(){
				$("#fillmorelefts ul li").attr("class","out");
				$(".fillmoreright1").css("display","none");
				$(".fillmorerights2_div1_class").css("display","none");
				$("#fillmorerights2").animate({width:'400px'},300).css("display","block");
				 $("#fillmores").animate({width:'500px'},300);
				 $("#a2").attr("class","over"); 
			});
			$("#a3").click(function(){
				$("#fillmorelefts ul li").attr("class","out");
				$(".fillmoreright1").css("display","none");
				$(".fillmorerights2_div1_class").css("display","none");
				$("#fillmorerights3").animate({width:'400px'},300).css("display","block");
				$("#fillmores").animate({width:'500px'},300);
				 $("#a3").attr("class","over"); 
			});
			$("#a4").click(function(){
				$("#fillmorelefts ul li").attr("class","out");
				$(".fillmoreright1").css("display","none");
				$(".fillmorerights2_div1_class").css("display","none");
				$(".fillmorerights3_div1_class").css("display","none");
				$("#fillmorerights4").animate({width:'400px'},300).css("display","block");
				$("#fillmores").animate({width:'500px'},300);
				 $("#a4").attr("class","over"); 
			});
			$("#a5").click(function(){
				$("#fillmorelefts ul li").attr("class","out");
				$(".fillmoreright1").css("display","none");
				$(".fillmorerights2_div1_class").css("display","none");
				$(".fillmorerights3_div1_class").css("display","none");
				$("#fillmorerights5").animate({width:'400px'},300).css("display","block");
				$("#fillmores").animate({width:'500px'},300);
				 $("#a5").attr("class","over"); 
			});
			$("#a6").click(function(){
				$("#fillmorelefts ul li").attr("class","out");
				$(".fillmoreright1").css("display","none");
				$("#fillmorerights6_contents_textarea").val("");
				$(".fillmorerights2_div1_class").css("display","none");
				$(".fillmorerights3_div1_class").css("display","none");
				$("#fillmorerights6").animate({width:'400px'},300).css("display","block");
				$("#fillmores").animate({width:'500px'},300);
				$("#a6").attr("class","over"); 
			});
			//对于评论区域
			$("#contents_fillmorecontents_a1").click(function(){
					$(".contents_fillmorecontents_div").css("display","block").animate({width:'500px'},300);
			});
			
			//点击界面，隐藏详细内容
			$("#backgrounds").click(function(){
				//判断评论区域是否显示
				if($(".contents_fillmorecontents_div").css("width")=="500px"&&$("#fillmores").css("width")=="500px")
				{
					$(".contents_fillmorecontents_div").animate({width:'0px'},150);
					$("#fillmorerights_contents_textarea").val("");
					$("#fillmores").css("width","500px");
				}
				else  if($("#fillmores").css("width")=="500px")
				{	
					console.info("推荐在");
					 $(".contents_fillmorecontents_div").css("display","none");
					 $("#fillmores").animate({width:'100px'},300);
					 $("#fillmorelefts").attr("right","0px;");
					 $("#fillmorelefts ul li").attr("class","out");
				}
				else if($(".contents_fillmorecontents_div").css("width")=="500px"&&$("#fillmores").css("width")=="100px")
				{
					$(".contents_fillmorecontents_div").animate({width:'0px'},150);
					$("#fillmorerights_contents_textarea").val("");
				}
			});
			var timer=null;
			//对于推荐图片的轮换
			show_times=setInterval("show_fillmoreright1_photo()",time);
			$("#fillmoreright1_photo").bind("mousemove", function(){
					show_times=clearInterval(show_times);
			});
			$("#fillmoreright1_photo").bind("mouseout", function(){
					show_times=setInterval("show_fillmoreright1_photo()",time);
			});
			$(".log_user_info_del").click(function(){
				$(".log_user").css("display","none");
				$(".log_user_info").css("display","none");
			});
			
			var fid=$("#Name").attr("class");
			var mid=$("#NameMusic").attr("class");
			if(fid!=undefined){
				$.ajax({
					type:"post",
					url:"../json/FmArticleAction_searchGood",
					data:{
						'fid':fid
					},
					success:function(data){
						//对于点赞
						if(data.result==2){
							$("#contents_fillmore_class2").css("background-position","0px -80px");
						}else{
							$("#contents_fillmore_class2").css("background-position","0px -18px");
						}
						//对于收藏
						if(data.total==2){
							$("#contents_fillmore_class3").css("background-position","0px -80px");
						}else{
							$("#contents_fillmore_class3").css("background-position","0px -18px");
						}
					}
				});
							}
			
			/*if(mid!=undefined){
				$.ajax({
					type:"post",
					url:"../fmArticleServlet?op=SerachGoodMusic",
					data:{
						id:mid
					},
					success:function(data){
						data=parseInt($.trim(data));
						if(data==1){
							$("#contents_fillmore_class2").css("background-position","0px -80px");
						}else{
							$("#contents_fillmore_class2").css("background-position","0px -18px");
						}
					}
				});
			}*/
		});

		//对图片轮换的处理事件
			var time=3000;  //停留时间
			var show_total;  //索引图片的总数
			var show_num;
			var current_index=0;
			var show_times;
			function show_fillmoreright1_photo()
			{
				show_total=$(".fillmoreright1_photo_ul1 img");
				show_num=$(".fillmoreright1_photo_ul1 li");	
				current_index=current_index%show_total.length;
				for(var i=0;i<show_total.length;i++)
				{
					if(i==current_index)
					{
						show_total[i].style.display="block";	
					}	
					else
					{
						show_total[i].style.display="none";	
					}
				}
				current_index++;
			}

/*function fmMusicGood(mid){
	var backgroundImag=$("#contents_fillmore_class2").css("background-position");
	$.post("../fmArticleServlet?t="+new Date(),{op:"FmMusicGood",fmMusic:mid},function(data){
		data=parseInt($.trim(data));
		if(data==0){
			$(".log_user").css("display","block");
			$(".log_user_info").css("display","block");
		}else {
			var background=$("#contents_fillmore_class2").css("background-position");
			if('0px -18px'==background){
				$("#contents_fillmore_class2").css("background-position","0px -80px");
			}else if('0px -80px'==background){
				$("#contents_fillmore_class2").css("background-position","0px -18px");
			}
		}
	});
}

//对于点赞事件的处理
function fmArticleGood(fid){
		var backgroundImag=$("#contents_fillmore_class2").css("background-position");
		$.post("../fmArticleServlet?t="+new Date(),{op:"FmArticleGood",fmActicle:fid},function(data){
			data=parseInt($.trim(data));
			if(data==0){
				$(".log_user").css("display","block");
				$(".log_user_info").css("display","block");
			}else {
				var background=$("#contents_fillmore_class2").css("background-position");
				if('0px -18px'==background){
					$("#contents_fillmore_class2").css("background-position","0px -80px");
				}else if('0px -80px'==background){
					$("#contents_fillmore_class2").css("background-position","0px -18px");
				}
			}
		});
}
//对于用户收藏处理
function fmArticleGet(id){
	var backgroundImag=$("#contents_fillmore_class3").css("background-position");
	$.post("../fmArticleServlet?t="+new Date(),{op:"FmArticleGet",fmActicle:id},function(data){
		data=parseInt($.trim(data));
		if(data==0){
			$(".log_user").css("display","block");
			$(".log_user_info").css("display","block");
		}else {
			var background=$("#contents_fillmore_class3").css("background-position");
			if('0px -18px'==background){
				$("#contents_fillmore_class3").css("background-position","0px -80px");
			}else if('0px -80px'==background){
				$("#contents_fillmore_class3").css("background-position","0px -18px");
			}
		}
	});
}

function submitInfo(){
	var email=$("#user_id").val();
	var pwd=$("#user_pad").val();
	
	if(email == "") {
		alert("邮箱不能为空!");
		return;
	}
	if(pwd == "") {
		alert("密码不能为空!");
		return;
	}
	
	$.post("../registerServlet",{op:"userLogin",email:email,pwd:pwd},function(data){
		data=parseInt($.trim(data));
		if(data==1){
			$(".log_user").css("display","none");
			$(".log_user_info").css("display","none");
			 window.location.reload(); //重定后 再刷新页面 
		}else{
			alert("邮箱或密码错误...");
		}											
	});
}
*/
//对于登录
function logInfo(){
	//$.post("../fmArticleServlet?t="+new Date(),{op:"FmUserInfo"},function(data){
	//	data=parseInt($.trim(data));
	//	if(data!=1){
			$(".log_user").css("display","block");
			$(".log_user_info").css("display","block");
	//	}else {
	//		 window.location.reload(); //重定后 再刷新页面 
	//	}
	//});
}
/*
//对于文章  用户查看评论
function findComment(id){
	$.post("../fmArticleServlet?t="+new Date(),{op:"findComment",fid:id},function(data){
		var str="";
		$.each(data.rows,function(index,item){
			str+='<li style="border-bottom:1px #E1E1E1 dashed"><a class="FM_img"><img src="../images/userlogin.jpg"/></a><div class="mentality_div"><a>用户'+item.w_uid+'</a><br/><a>'+item.ccontent+'</a><p>'+item.ctime.substring(0,item.ctime.length-2)+'</p></div></li>';
		});
		$("#fillmorerights_contents_ul").html(str);
	},"json");
}

//对于轻音乐  用户查看评论
function findCommentMusic(id){
	$.post("../fmArticleServlet?t="+new Date(),{op:"findCommentMusic",mid:id},function(data){
		var str="";
		if(data!=null){
		$.each(data.rows,function(index,item){
			str+='<li id='+item.w_uid+' style="border-bottom:1px #E1E1E1 dashed"><a class="FM_img"><img src="../images/userlogin.jpg"/></a><div class="mentality_div"><a>用户'+item.w_uid+'</a><br/><a id='+item.cid+'>'+item.ccontent+'</a><p>'+item.ctime.substring(0,item.ctime.length-2)+'</p></div></li>';
		});
		$("#fillmorerights_contents_ul").html(str);
		}
	},"json");
}

//对于查看查看留言
function AllNote(){
	$.post("../fmArticleServlet?t="+new Date(),{op:"findNotes",},function(data){
		var str="";
		$.each(data.Info,function(index,item){
			str+='<li style="border-bottom:1px #E1E1E1 dashed"><a class="FM_img"><img src="../images/userlogin.jpg"/></a><div class="mentality_div"><a>用户'+item.w_uid+'</a><br/><a>'+item.ccontent+'</a><p>'+item.ctime.substring(0,item.ctime.length-2)+'</p></div></li>';
		});
		$("#fillmorerights6_contents_ul").html(str);
	},"json");
}
*/